<?php

require 'lib/model/om/BaseColoana.php';

class Coloana extends BaseColoana
{
    /**
     * Se foloseste pt generarea automata a optiunilor unui <select>
     *
     * @return string
     */
    public function __toString()
    {
        return $this->getLongName();
    }

    /**
     * Returneaza denumirea completa a coloanei (este inclusa si coloana 'detaliu')
     */
    public function getLongName()
    {
        $detaliu = trim($this->getDetaliu());

        return $this->getDenumire() .
               (strlen($detaliu) ? (' (' . $detaliu . ')') : '');
    }

    /**
     * Returneaza, ca obiect, criteriul asociat
     * @return Criteriu
     */
    public function getCriteriu()
    {
        return CriteriuPeer::factory($this->getCriteriuId());
    }

    /**
     * Returneaza formularul ce contine parametrii suplimentari necesari criteriului de distribuire
     *
     * @return CriteriuForm
     */
    public function getCriteriuForm()
    {
        return $this->getCriteriu()->getExtraParamsForm();
    }


}
